package com.efounder.frame.utils;


import android.graphics.drawable.Drawable;

import java.io.File;

/**
 * Created by XinQing on 2016/8/23.
 */

public class EFDrawableUtils {

    /***
     * 从配置文件中获取drawable
     * @param imageName
     * @return
     */
    public static Drawable getDrawableFromConfigurationFile(String imageName){
        Drawable drawable = null;
        String normalIconPath = EFConstants.IMAGE_DIR + "/" + imageName;
        File file = new File(normalIconPath);
        if (file.exists()) {
            drawable = Drawable.createFromPath(normalIconPath);
        }
        return  drawable;
    }
    /***
     * 从配置文件中获取drawable
     * @param imageName
     * @return
     */
    public static Drawable getDrawableFromConfigurationFile(String path,String imageName){
        Drawable drawable = null;
        String normalIconPath = path + "/" + imageName;
        File file = new File(normalIconPath);
        if (file.exists()) {
            drawable = Drawable.createFromPath(normalIconPath);
        }
        return  drawable;
    }

}
